home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Milan_1991 / Devcon91.1 / Libraries / Commodities / NoCapsLock / nocapslock.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-01  |  2.0 KB  |  72 lines

  1.  
  2.    /***********************************************************************
  3.    *                                                                      *
  4.    *                            COPYRIGHTS                                *
  5.    *                                                                      *
  6.    *   Copyright (c) 1990  Commodore-Amiga, Inc.  All Rights Reserved.    *
  7.    *                                                                      *
  8.    ***********************************************************************/
  9.  
  10. #include "app.h"
  11.  
  12. /* An input expression to match any RAWKEY event with the
  13.  * CAPSLOCK qualifier bit set
  14.  */
  15. IX myix = {
  16.    IX_VERSION,             /* required                           */
  17.    IECLASS_RAWKEY,
  18.  
  19.    0,                      /* Code: won't care                     */
  20.    0,                      /* CodeMask: 0 means don't care about Code   */
  21.  
  22.    IEQUALIFIER_CAPSLOCK,   /* qualifier I am interested in            */
  23.    IEQUALIFIER_CAPSLOCK,   /* and it's the only qualifier of interest   */
  24.    0                       /* synonyms irrelevant                  */
  25. };
  26.  
  27. BOOL setupNoCapsLock(void);
  28. void middlebaction(struct CxMsg *,CxObj *);
  29. void nocapsaction(struct CxMsg *,CxObj *);
  30.  
  31. BOOL setupNoCapsLock()
  32. {
  33.    char   **tt;
  34.    int      exitval = 0;
  35.  
  36.    CxObj   *filter;
  37.  
  38.    filter = CxFilter(NULL);
  39.    if (!filter)
  40.       return(0);
  41.  
  42.    SetFilterIX(filter, &myix);
  43.  
  44.    /** DEBUG **/
  45.    D( AttachCxObj(filter, CxDebug( 0xDEADFACE)) );
  46.  
  47.    AttachCxObj(filter, CxCustom( nocapsaction, 0L));
  48.  
  49.    if (CxObjError(filter))
  50.    {
  51.       D( printf("nocapslock: filter error %lx\n", CxObjError(filter) ) );
  52.       DeleteCxObjAll(filter);
  53.       return(0);
  54.    }
  55.  
  56.    AttachCxObj(broker, filter);
  57.    return(TRUE);
  58. }
  59. void nocapsaction(cxm,co)
  60. register struct CxMsg *cxm;
  61. CxObj *co;
  62. {
  63.    register struct InputEvent *ie;
  64.  
  65.    D( kprintf("nocapsaction\n") );
  66.  
  67.    /* i KNOW that all messages getting this far are CXM_IEVENT   */
  68.    ie = (struct InputEvent *) CxMsgData(cxm);
  69.  
  70.    ie->ie_Qualifier &= ~IEQUALIFIER_CAPSLOCK;
  71. }
  72.